package com.cheng.dreams.sample.entity.request;


import com.cheng.dreams.sample.util.AES256Util;
import com.google.gson.Gson;

import java.util.Map;
import java.util.TreeMap;

/**
 * CreateTime: 2016-04-26下午1:06
 * Author: wjkjinke00@126.com
 * Description:
 */
public abstract class MapParamsRequest extends BaseRequest {
    protected TreeMap<String, String> params;

    public MapParamsRequest() {
        this.params = new TreeMap<>();
    }

    public Map<String, String> params() {
        params.clear();
        putParams();
        return params;
    }

    protected abstract void putParams();

    public String getJson(){
        String json = AES256Util.encrypt(new Gson().toJson(params()));
        return json;
    }
}
